package com.hualian.coupon.service.impl;

import com.hualian.coupon.mapper.MemberMapper;
import com.hualian.coupon.pojo.Coupon;
import com.hualian.coupon.pojo.Member;
import com.hualian.coupon.service.MemberService;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author Lxd
 * @Description TODO
 * @date 2020/10/22 16:49
 * @Version 1.0
 */

@Service("memberService")
public class MemberServiceImpl implements MemberService {

    @Resource
    MemberMapper memberMapper;

    @Override
    public Member findByPhone(String phone) {
        Member member = new Member();
        member.setPhone(phone);
        return memberMapper.selectOne(member);
    }

    @Override
    public int add(String name,String phone) {
        Member member = new Member();
        member.setPhone(phone);
        member.setName(name);
        member.setRegDate(new Date());
        return memberMapper.insertSelective(member);
    }

    @Override
    public List<Member> queryAll() {
        return memberMapper.selectAll();
    }


}
